﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>@ViewBag.Title - My ASP.NET Application</title>
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
</head>
<body>
    <div class="navbar navbar-fixed-top" style="background-color:#5cb85c ;border-color:#4cae4c;">
        <div class="container">
            <div class="navbar-header">
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" rel="home" href="#" title="Solution4All">
                    <img src="/Content/cooltext1719494525.png">
                </a>
                
            </div>
            @*<div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li>@Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)</li>
                    <li>@Html.ActionLink("API", "Index", "Help", new { area = "HelpPage" }, null)</li>
                </ul>
                @Html.Partial("_LoginPartial")
            </div>*@
        </div>
    </div>
    <br />
    <br />
    <div class="container body-content">
        <div class="row">
            <div class="col-md-12">
                <div class="widget">
                    <div class="widget-content no-padding" id="msgContainer">
                    </div>
                </div>
            </div>
        </div>
        
        @RenderBody()
        @RenderSection("SPAViews", required: false)
        <hr />
        <footer>
            <p>&copy; @DateTime.Now.Year - Easy Solution 4 All</p>
        </footer>
    </div>
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title" id="myModalLabel">Status</h4>
                </div>
                <div class="modal-body" id="dialogContentText" style="margin-bottom: 0px !important;padding: 0px">
                    
                </div>
                <div class="modal-footer" style="padding:10px 20px 10px;margin-top:0px">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" onclick="nextQuestion()">Next Question</button>
                </div>
            </div>
        </div>
    </div>
 
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    @RenderSection("Scripts", required: false)
    <script>
        function nextQuestion() {
            location.reload();
        }
            
        function checkAnswer(questionSetId, answerId) {
            var date = new Date().getMilliseconds();
        CallPost(
            "CheckAnswer",
            { questionSetId: questionSetId, answerId: answerId },
            function (data, textStatus, XMLHttpRequest) {
               // alert(data == "True");
                if (data.result) {
                    ShowMsgBox("Your answer is correct", "alert-success");
                } if (!data.result) {
                    ShowMsgBox("Your answer is incorrect", "alert-dismissable");
                }
                
            },
            null);
    }
        function CallPost(actioName, data, successFunction, errorFunction) {
            $.ajax({
                type: "POST",
                url: actioName,
                data: data,
                success: successFunction,
                dataType: "json",
                cache:false
            });
    }
    var msgContent = "<div class='alert fade in {alertType}'><i data-dismiss='alert' class='icon-remove close'></i>{message}</div>";

    function ShowMsgBox(msg, alertType) {
        
        var message = msgContent.replace("{alertType}", alertType).replace("{message}", msg);
        $("#dialogContentText").html(message);
        $('#myModal').modal();
    }

    $(document).ready(function() {
        $.ajaxSetup({
            type: 'POST',
            cache:false,
            headers: { "cache-control": "no-cache" }
        });

        $('#myModal').on('hidden', function () {
            $(this).remove();
        });
        }
    );
    
    </script>
</body>
</html>
